{% extends "/home/steveswanson/webapps/django/myuwaterloo/templates/home.html" %}

{%block title%}Search{% if query %} Results for {{query}}{% endif %}{%endblock%}

{%block content%}
 <div id="search">
  <h2 id="search">Search For A Course</h2>
  
  <form id="search" action="." method="GET">
    <input class="tb-gradient2" type="text" name="q" value="{{ query|escape }}">
	<input class="bt-search2" type="submit" value="Search">
  </form>
  <p id="underSearch">
	Examples:<br>
	<i>
		By Keyword: C++<br>
		By Department: SYDE<br>
		By Professor: Jernigan<br>
		<br>
	</i>
   </p>
 </div>

 <br>
 
{% if query %}
<div id="search">
	<h2>Results for "{{ query|escape }}":</h2>
	
    {% if results %}
      <TABLE id="searchTable" cellSpacing="1" cellPadding="1" border="2" width="96%" align="center" >
		<TR style="background-color:#D8FF9B; font-weight:bold">
			<td> Course</td>
			<td> Description</td>
			<td> Time</td>
		</TR>
	    {% for result in results %}
			<TR style="font-size:10pt">    
				<td width="150"><a href="http://myuwaterloocourses.com/{{result.department|escape}}{{ result.class_field|escape }}">{{ result.department|escape }} {{ result.class_field|escape }}</a><br>{{ result.name|escape }}</td>
				<td>{{ result.description|escape }}</td>
				<td>{{result.schedule|escape}}</td>
			</TR>
		{% endfor %}
      </TABLE>
	  <br>
    {% else %}
      <p>No classes found</p>
    {% endif %}

</div>	
{% endif %}

 
{%endblock%}